import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'

Vue.use(VueRouter)

// name不可以重名

const routes = [
  {
    path: '/',
    name: '首页',
    component: HomeView
  },
  {
    path: '/about',
    name: '任务',
    icon: 'el-icon-goods',
    redirect: '/about/ceshi',
    component: () => import('../views/secondRouter.vue'),
    children: [{
      icon: ' ',
      name: '任务一',
      path: 'ceshi',
      component: () => import('../views/renwu1.vue')
    }]
  },
  {
    path: '/login',
    name: 'login',
    isHidden: true,
    component: () => import('../views/login.vue')
  },
  {
    path: '/404',
    name: '404',
    isHidden: true,
    component: () => import('../views/404.vue')
  },
  {
    path: '*',
    isHidden: true,
    redirect: '/404'
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
